<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>客户管理</title>
    <meta http-equiv="Pragma" content="no-cache"/>
    <meta http-equiv="no-cache"/>
    <meta http-equiv="Expires" content="-1"/>
    <meta http-equiv="Cache-Control" content="no-cache"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta content="telephone=no" name="format-detection"/>
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <!-- Bootstrap 3.3.6 -->
    <style type="text/css">
        [v-cloak] {
            display: none;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            outline: none;
        }

        body {
            font-size: .2rem
        }

        table {
            border-collapse: collapse;
            /*border-right: 1px solid #cbcbcd;*/
            /*border-bottom: 1px solid #cbcbcd;*/
            margin-left: 0px;
            margin-top: 0px;
            margin-bottom: -1px !important;
            margin-right: 0px;
        }

        td {
            /*border-top: 1px solid #cbcbcd;
            border-left: 1px solid #cbcbcd;*/
            color: #333;
            font-weight: normal;
            position: relative;
        }

        td.td-value {
            text-align: center !important;
            height: .48rem;
            font-size: .18rem;
        }

        .table {
            width: 100%
        }

        .table .td-title, .table .td-module {
            background-color: #f8f8f8;
            text-align: center;
            line-height: .52rem;
        }

        .table .td-module {
            font-weight: bold;
        }

        .table .td-value span, .table .td-value input[type="text"], .td-value {
            text-align: center !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: #000 !important;
        }

        .box-header {
            line-height: .6rem;
        }

        .pd_1 {
            padding-left: .1rem
        }

        .td-title {
            /*width: 25%*/
        }

        /*.btn-blue {*/
        /*border: none;*/
        /*background: #2a8cec;*/
        /*color: #fff;*/
        /*font-size: 0.22rem;*/
        /*!*height: 0.58rem;*!*/
        /*width: 14%;*/
        /*}*/

        .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
            color: #fff;
            text-decoration: none;
        }

        .formbox {
            padding-left: .02rem;
            padding-top: .1rem
        }

        .red td {
            color: red !important;
        }

        .orange td {
            color: #dfa019 !important;
        }

        .moune {
            padding-right: .08rem;
            color: #2a8cec;
            font-weight: bold
        }

        .lineOne {
            text-align: center;
        }

        .lineOne span {
            max-height: 16px;
            line-height: 17px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: center;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .tryStyle {
            width: 34px;
            height: 17px;
            line-height: 17px;
            font-size: 12px;
            top: 0px;
            right: -2px;
            position: absolute;
            border-radius: 50px;
            margin-top: 4px;
            background: #FF0000;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.7);
            text-align: center !important;
        }

        .left {
            text-align: center;
            color: #228bee;
            border-bottom: 2px solid #228bee;
            margin-left: 8px;
            margin-right: 8px;
            padding-bottom: 5px;
        }

        .right {
            text-align: center;
            color: #666666;
            font-size: 12px;
            /*border-bottom: 2px solid #f8f8f8;*/
            margin-left: 4px;
            margin-right: 4px;
            padding-top: 5px;
            padding-bottom: 5px;
        }

        .slide-box1 {
            margin-top: 5px;
            margin-bottom: 5px;
            display: -webkit-box;
            overflow-x: scroll;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            height: 30px;
        }

        .lefts {
            text-align: center;
            color: #2a8cec;
            background-image: url(/dist/img/tabApp.png);
            margin-left: 8px;
            margin-right: 8px;
            background-size: 100% 100%;
            padding: 10px 15px 15px;
        }

        .rights {
            text-align: center;
            color: #fff;
            font-size: 14px;
            /*border-bottom: 2px solid #f8f8f8;*/
            margin-left: 4px;
            margin-right: 17px;
            margin-top: 3px;
            padding-bottom: 5px;
        }

        .slide-box {
            display: -webkit-box;
            overflow-x: scroll;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            height: 45px;
            line-height: 45px;
            background: #2a8cec;
            float: left;
            padding-left: 35px;
            position: fixed;
            top: 0;
            width: 100%;
            z-index: 2000;
        }

        .fixed-table_body tr td {
            border-right: none;
            border-bottom: 1px;
            font-size: 12px;
            text-align: center;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
            text-align: center;
        }

        .fixed-table-box td {
            text-align: center;
        }

        table thead, tbody tr {
            display: table;
            width: 100%;
            table-layout: fixed;
            border-bottom: 1px solid #eeeeee;
        }

        .tabContent {
            display: flex;
            height: 45px;
            line-height: 45px;
            background: #2a8cec;
        }

        .tabContentLeft {
            width: 45px;
        }

        .tabContentRight {
            width: 45px;
        }

        .tabContentMiddle {
            background: #2a8cec;
            flex: 1;
            overflow: hidden;
        }

        .tabActive {
            font-size: 14px;
            text-align: center;
            color: #2a8cec;
            background-image: url(/dist/img/tabApp.png);
            /* margin-left: 8px; */
            /* margin-right: 8px; */
            background-size: 100% 100%;
            /* padding: 10px 15px 15px; */
            float: left;
            height: 38px;
            line-height: 38px;
            margin-top: 9px;
            width: 50%;
        }

        .tabNo {
            text-align: center;
            font-size: 14px;
            color: #fff;
            /* margin-left: 8px; */
            /* margin-right: 8px; */
            background-size: 100% 100%;
            /* padding: 10px 15px 15px; */
            float: left;
            height: 38px;
            line-height: 38px;
            margin-top: 9px;
            width: 50%;
        }

        /**应收**/
        .table > tbody > tr > td {
            line-height: 28px;
            max-height: 28px;
            overflow: hidden;
        }

        .content {
            padding: 2px;
        }

        span.lineOne {
            line-height: 28px;
            height: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            /*-webkit-line-clamp: 1;*/
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .divCheck {
            height: 100%;
            margin-left: 5px;
            line-height: 40px;
        }

        .divCheck input {
            float: left;
            margin-top: 10px;
            margin-right: 5px;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .red {
            color: #fff;
            background: red;
        }

        .blue {
            color: #000;
            background-color: orange;
        }

        .ygColor {

        }

        .redFont {
            color: red;
        }

        .orangeFont {
            color: orange;
        }
        .table > thead > tr > th {
            border-bottom: 1px solid #cbcbcd;
            background: #F8F8F8;
        }

        .btn-blue {
            border: none;
            background: #2a8cec;
            color: #fff;
            width: 14%;
            height: 30px;
            /*margin-top: 5px;*/
        }

        .btn-blue.focus, .btn-blue:focus, .btn-blue:hover {
            color: #fff;
            text-decoration: none;
        }

        table {
            border-spacing: 0;
            border-collapse: collapse;
            display: table;
        }

        * {
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
        }

        /*.templateStyle {*/
        /*margin-top: 10px;*/
        /*}*/
        .tabContent {
            display: flex;
            height: 45px;
            line-height: 45px;
            background: #2a8cec;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            z-index: 9999;
        }

        .tabContentLeft {
            width: 25px;
        }

        .tabContentRight {
            width: 20px;
        }

        .tabContentMiddle {
            background: #2a8cec;
            flex: 1;
            overflow: hidden;
        }

        .tabActive {
            font-size: 14px;
            text-align: center;
            color: #2a8cec;
            background-image: url(/dist/img/tabApp.png);
            /* margin-left: 8px; */
            /* margin-right: 8px; */
            background-size: 100% 100%;
            /* padding: 10px 15px 15px; */
            float: left;
            height: 38px;
            line-height: 38px;
            margin-top: 9px;
            width: 33%;
        }

        .tabNo {
            text-align: center;
            font-size: 14px;
            color: #fff;
            /* margin-left: 8px; */
            /* margin-right: 8px; */
            background-size: 100% 100%;
            /* padding: 10px 15px 15px; */
            float: left;
            height: 38px;
            line-height: 38px;
            margin-top: 9px;
            width: 33%;
        }

        .boxBoy {
            background: #fff;
        }

        .boxItem {
            width: 100%;
            margin-top: -1px;
            padding-bottom: 0;
            background: inherit;
            background-color: rgba(255, 255, 255, 1);
            border: none;
            position: relative;
        }
    </style>
</head>
<body>
<section class="content" id="app" style="padding: 0px;" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <!--表头-->
    <div class="tabContent">
        <div class="tabContentLeft"></div>
        <div class="tabContentMiddle">
             <span :class="selectCompany==i? 'tabActive':'tabNo'" v-for="(item,i) in tabList"
                   @click="selectCompany=i;clickTab(item.position)">
                   {{item.name}}
                </span>

        </div>
        <div class="tabContentRight"></div>
    </div>


    <!--意向客户-->
    <div style="margin: 53px 10px 0 10px;" v-if="position == 1 ">
        <!--本月目标完成情况-->
        <div class="templateStyle" style="margin-top: 10px;">
            <div class="boxItem">

                <div class="boxBoy">

                    <table class="table table-bordered text-center table-width">
                        <tbody>
                        <tr>
                            <td style="background-color: #2c8cec;color: white;text-align: center;top:4px;">
                                2019年销售目标：{{info.targetNum}}，完成：{{info.finishSum?info.finishSum:0}}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div v-if="regionAuditFlag!='1'"
                         style="border: 1px solid #eeeeee;color: red;font-size:12px;text-align: center;height: 28px;line-height: 32px;">
                        上级销售目标暂未配置完成。
                    </div>
                    <table v-else class="table table-bordered text-center table-width">
                        <tbody>
                        <tr>
                            <td colspan="6">一季度</td>
                            <td colspan="6">二季度</td>
                        </tr>
                        <tr>
                            <td colspan="2">1月</td>
                            <td colspan="2">2月</td>
                            <td colspan="2">3月</td>
                            <td colspan="2">4月</td>
                            <td colspan="2">5月</td>
                            <td colspan="2">6月</td>

                        </tr>
                        <tr>
                            <td style="padding: 0" :colspan="hideFinish(1)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(1)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(2)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(2)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(3)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(3)">完成</td>
                            <!--二季度-->
                            <td style="padding: 0" :colspan="hideFinish(4)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(4)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(5)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(5)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(6)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(6)">完成</td>
                        </tr>
                        <tr>
                            <td :colspan="hideFinish(1)?'1':'2'">{{info.jan}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(1)">{{info.janFinish}}</td>
                            <td :colspan="hideFinish(2)?'1':'2'">{{info.feb}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(2)">{{info.febFinish}}</td>
                            <td :colspan="hideFinish(3)?'1':'2'">{{info.mar}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(3)">{{info.marFinish}}</td>
                            <td :colspan="hideFinish(4)?'1':'2'">{{info.apr}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(4)">{{info.aprFinish}}</td>
                            <td :colspan="hideFinish(5)?'1':'2'">{{info.may}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(5)">{{info.mayFinish}}</td>
                            <td :colspan="hideFinish(6)?'1':'2'">{{info.june}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(6)">{{info.juneFinish}}</td>
                        </tr>
                        <tr>
                            <td colspan="6">三季度</td>
                            <td colspan="6">四季度</td>
                        </tr>
                        <tr>
                            <td colspan="2">7月</td>
                            <td colspan="2">8月</td>
                            <td colspan="2">9月</td>
                            <td colspan="2">10月</td>
                            <td colspan="2">11月</td>
                            <td colspan="2">12月</td>

                        </tr>
                        <tr>
                            <!--三季度-->
                            <td style="padding: 0" :colspan="hideFinish(7)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(7)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(8)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(8)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(9)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(9)">完成</td>
                            <!--四季度-->
                            <td style="padding: 0" :colspan="hideFinish(10)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(10)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(11)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(11)">完成</td>
                            <td style="padding: 0" :colspan="hideFinish(12)?'1':'2'">目标</td>
                            <td style="padding: 0" v-if="hideFinish(12)">完成</td>
                        </tr>
                        <tr>
                            <td :colspan="hideFinish(7)?'1':'2'">{{info.july}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(7)">{{info.julyFinish}}</td>
                            <td :colspan="hideFinish(8)?'1':'2'">{{info.aug}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(8)">{{info.augFinish}}</td>
                            <td :colspan="hideFinish(9)?'1':'2'">{{info.sept}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(9)">{{info.septFinish}}</td>
                            <td :colspan="hideFinish(10)?'1':'2'">{{info.oct}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(10)">{{info.octFinish}}</td>
                            <td :colspan="hideFinish(11)?'1':'2'">{{info.nov}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(11)">{{info.novFinish}}</td>
                            <td :colspan="hideFinish(12)?'1':'2'">{{info.dece}}</td>
                            <td style="background: #F8F8F8;" v-if="hideFinish(12)">{{info.deceFinish}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <div class="clear"></div>
            </div>
        </div>
        <!--意向列表-->
        <div class="templateStyle" style="margin-top: 10px;">
            <div class="boxItem" style="border: 1px solid #eeeeee;">
                <div class="boxBoy">
                    <table class="table table-bordered text-center table-width">
                        <tbody>
                        <tr>
                            <td style="background-color: #2c8cec;color: white;text-align: center;">意向列表</td>
                        </tr>
                        </tbody>
                    </table>
                    <table class="table table-bordered text-center table-width">
                        <tbody>
                        <tr style="line-height: 24px;    background: #f8f8f8;">
                            <td class="tdColor" style="width: 38px;line-height:15px;text-align: center;">客户</td>
                            <td class="tdColor" style="width: 70px;line-height:15px;text-align: center;">电话</td>
                            <td class="tdColor" style="width: 50px;line-height:15px;text-align: center;">意向<br>品牌</td>
                            <td class="tdColor" style="width: 50px;line-height:15px;text-align: center;">意向<br>机型</td>
                            <td class="tdColor" style="width: 40px;line-height:15px;text-align: center;">成交<br>时间</td>
                            <td class="tdColor" style="width: 40px;line-height:15px;text-align: center;">成交<br>概率</td>
                        </tr>
                        <tr v-for="(item,i) in yxList">
                            <td style="color: #2a8cec;width: 38px;" @click="openDetail(item.customerId,0,'edit')"
                                class="lineOne">
                                <span style="text-align: center;">{{item.customerName}}</span>
                            </td>
                            <td style="color: #2a8cec;text-align: center;width: 70px;" @click="openTel(item)">
                                {{item.customerTel}}
                            </td>
                            <td class="lineOne" style="width: 50px;">
                                <span style="text-align: center;">{{item.intentionBrand}}</span>
                            </td>
                            <td class="lineOne" style="width: 50px;">
                                <span style="text-align: center;">{{item.intentionModel}}</span>
                            </td>
                            <td style="text-align: center;width: 40px;">{{changeBuyDate(item.buyDate)}}</td>
                            <td style="text-align: center;width: 40px;">{{item.chance}}</td>
                        </tr>
                        </tbody>
                    </table>
                    <div v-if="returnFlag" class="table-bordered">
                        <div style="margin: 0 auto;color: #999999;text-align: center;padding: 32px;font-size: 16px;background: #fff;"
                             v-if="!yxList ||yxList.length<=0">
                            暂无意向客户
                        </div>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
        </div>
        <!--<div style="height: 15px;width: 100%"></div>-->
        <!--<div style="height: 58px;"></div>-->
        <!--<button type="button" class="btn btn-blue" style="border-top: 1px solid white"-->
        <!--@click="openDetail('',1,'edit')">新增意向客户-->
        <!--</button>-->
    </div>

    <!--应收客户-->
    <div style="margin-top: 53px;" v-if="position == 2 ">
        <div style="display:flex;height: 30px;margin-bottom: 10px;margin-top:53px;">
            <input type="text" placeholder="关键字"
                   style="flex: 1;height:30px;outline: none;margin-left: 4px;padding-left: 4px;border: 1px solid #cbcbcd;"
                   v-model="searchParams.customerKey" id="txtParent">
            <button type="button" class="btn btn-blue" style="margin-left: 10px;float: left;" @click="getList">查询
            </button>
            <div class="pull-left divCheck">
                <label style="margin-top: 10px"><input type="checkbox" id="cbCheck" v-model="haveSettle"
                                                       @change="getList"
                >显示已结清
                </label>
            </div>
        </div>
        <div class="box-body no-padding iframeH2" style="overflow: auto;" id="">
            <table class="table table-bordered text-center" style="table-layout: auto">
                <thead>
                <tr style="height: 28px;">
                    <th style="width: 15%">公司</th>
                    <th style="width: 15%">客户</th>
                    <th style="width:19%">到期日期</th>
                    <!--<th style="width: 100px">品牌</th>-->
                    <!--<th style="width: 61px">设备类型</th>-->
                    <th style="width: 17%">到期金额</th>
                    <th style="width: 17%">逾期罚息</th>
                    <th style="width: 17%">合计</th>
                    <!--<th style="width: 39px">结清</th>-->
                    <!--<th style="width: 39px">逾期</th>-->

                    <!--<th style="width: 61px">大区经理</th>-->
                    <!--<th style="width: 61px">债权经理</th>-->
                    <!--<th style="width: 61px">数据专员</th>-->
                </tr>
                </thead>
                <tbody id="tbList">
                <tr v-for="(item,i) in tablesMergeCell(ysList)">
                    <!--<td>{{i+1}}</td>-->
                    <td :rowspan="item.sellerspan" :class="{hidden: item.sellerdis}"><span class="lineOne">{{item.seller}}</span>
                    </td>
                    <td style="background-color: white;" :rowspan="item.buyerspan" :class="{hidden: item.buyerdis}">
                        <span class="lineOne" style="color:#2a8cec;cursor: pointer;" @click="goDetail('look',item)">{{item.buyer}}</span>
                    </td>
                    <td>
                    <span v-if="item.haveSettle == '1'">
                        已结清
                    </span>
                        <template v-else>
                        <span class="lineOne" style="text-align: left;">{{item.repaymentDate? item.repaymentDate.substring(5): '未到期'}}
                        <span style="text-align: center"
                              v-if="(Number(item.overduePenalty)>0||Number(item.remainingArrears)>0)&&compareFiveDate(item.repaymentDate)<0"
                              class="tryStyle">逾期</span>
                        <span v-else-if="Number(item.total)>0 && Number(item.overduePenalty)==0" class="tryStyle"
                              style="background: #2a8cec;color: #fff;text-align: center">到期</span>
                        </span>
                        </template>
                    </td>
                    <td :style="item.remainingArrears?'text-align: right':'text-align: right'"
                        v-if="(item.overduePenalty && Number(item.overduePenalty)>0)||(item.remainingArrears && Number(item.remainingArrears)>0)">
                        <span class="lineOne">{{item.remainingArrears ?fmoney(item.remainingArrears):'-'}}</span>
                    </td>
                    <td v-else :style="item.total?'text-align: right':'text-align: right'">
                        <span>{{item.total ? fmoney(item.total) :'-'}}</span>
                    </td>
                    <td :style="item.overduePenalty ? 'text-align: right':'text-align: right'">
                    <span class="lineOne"
                          v-if="(Number(item.overduePenalty)>0||Number(item.remainingArrears)>0)&&compareFiveDate(item.repaymentDate)<0"> {{item.overduePenalty? fmoney(item.overduePenalty):'未知'}}</span>

                        <span class="lineOne" v-else> {{item.overduePenalty? fmoney(item.overduePenalty):'-'}}</span>
                    </td>
                    <td :style="item.newMoney? 'text-align: center':'text-align: center'" :rowspan="item.buyerspan"
                        :class="{hidden: item.buyerdis}">
                        {{item.newMoney? fmoney(item.newMoney):'-'}}
                    </td>
                </tr>
                </tbody>
            </table>
            <!--<div class="oa-pager text-center" style="margin-top: 5px;">-->
            <!--共-->
            <!--<span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;-->
            <!--<span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;-->
            <!--<span class="oa-pager-button" id="first">首页</span>-->
            <!--<span class="oa-pager-button" id="prev">上一页</span>-->
            <!--<span class="oa-pager-button" id="next">下一页</span>-->
            <!--<span class="oa-pager-button" id="last">尾页</span>-->
            <!--</div>-->
        </div>
    </div>

    <!--全部客户-->
    <div style="margin-top: 58px;" v-if="position == 3 ">
        <div class="templateStyle">
            <div class="boxItem">
                <div style="position: fixed;top: 45px;width: 100%;z-index:1000;background-color: white;">
                    <input type="text" placeholder="请输入客户姓名或电话" class="form-control pull-left input-sm"
                           style="width:80%;height: 32px;vertical-align: top;border: 1px solid #cbcbcd;margin-right: 6px;padding-left: 4px;outline: none;margin-left: 4px;margin-top: 5px;"
                           v-model="cusKey">
                    <button type="button" class="btn btn-blue" style="margin-top: 5px;" @click="getCusList()">查询
                    </button>
                </div>
                <div class="boxBoy" id="scrollDiv" style="margin-top: 90px;">
                    <table class="table table-bordered text-center table-width" v-for="(item,i) in cusList">
                        <tbody>
                        <tr @click="openDetail(item.customerId,0,'edit')">
                            <td style="width: 50%;border-right: 0px;text-align: left;padding-left: 8px;">
                                {{item.name?item.name:item.customerName}}
                            </td>
                            <td style="width: 50%;border-left: 0px;text-align: right;padding-right: 8px;">{{item.customerTel}}
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div style="margin-bottom: 15px;"></div>
    </div>

</section>


<!--rem.js-->
<script src="/dist/js/pages/rem/rem.js"></script>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script src="/dist/js/oaApp.js"></script>
<script src="/dist/plugins/scroll/myScroll.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<!--<script src="/dist/plugins/fixedTable/fixed-table.js"></script>-->
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script>
    $.ajaxSetup({
        global: true,
        type: "POST",
        cache: false,
        dataType: "json",
        contentType: 'application/json;charset=utf-8',
        beforeSend: function () {
        },
        complete: function () {

        },
        error: function (e) {
            alert('error' + e.responseText);
        }
    });
    $.extend($.wyui, {
        page: {
            urlParams: null,
            queryParams: {
                requestPage: 1,
                pageSize: 30
            },
            dataUrl: '',
            getByPage_callback: null,
            createQueryParams: function () {
            },
            getByPage: function (type) {
                if (type == "scroll") {
                    $.wyui.page.queryParams.requestPage++;
                }
                $.ajax({
                    url: $.wyui.page.dataUrl,
                    data: JSON.stringify($.wyui.page.queryParams),
                    beforeSend: function () {

                    },
                    complete: function () {
                    },
                    success: function (r) {
                        $("#allCount").html(r.data.sendData.pager.recordCount);
                        $("#nowPage").html($.wyui.page.queryParams.requestPage);
                        if (r.data.sendData.pager.pageCount == 0) {
                            r.data.sendData.pager.pageCount = 1;
                        }
                        $("#allPage").html(r.data.sendData.pager.pageCount);
                        if (type == "scroll") {
                            $.wyui.page.getByPage_scroll_callback(r.data.sendData.records);
                        } else {
                            $.wyui.page.getByPage_callback(r.data.sendData.records);
                            if ($.wyui.page.getByPage_callback_new) {
                                $.wyui.page.getByPage_callback_new(r.data.sendData);
                            }
                        }

                    }
                });
            }
        },
        postMethod: function (url, data, callback, sync, id) {
            if (!id) {
                id = "#app"
            }
            $.ajax({
                url: server.ip + url,
                async: sync ? false : true,
                data: JSON.stringify(data),
                beforeSend: function () {

                },
                complete: function () {
                    setTimeout(function () {
                    }, 1000);

                },
                success: function (r) {
                    if (!r.e.code) {
                        callback(r.data.sendData);
                    } else {
                        alert(r.e.desc);
                    }
                },
                error: function (e) {
                    alert(url + e.responseText);
                }
            });
        },
    });
</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            userId: getUrlParamObj().userId,
            jobState: '',
            jobStates: {},
            key: '',
            list: [],
            selectCompany: 0,
            selectDepart: 0,
            ip: '',
            companyList: [],
            tabList: [],
            position: 1,
            appHeight: 0,
            //应收
            rightOp: [],//权限列表
            haveSettle: false,
            ysList: [],
            pageType: getUrlParamObj().pageType,
            searchParams: {
                auditFlag: 1,
                haveDelivery: 1,
                haveSettle: 0,
                userId: getUrlParamObj().userId,
                customerKeyId: '',
                createUserId: '',
                customerKey: '',
                createUserName: '',
                // requestPage: getUrlParamObj().requestPage ? getUrlParamObj().requestPage : 1,
                // pageSize: getUrlParamObj().pageSize ? getUrlParamObj().pageSize : 20,
            },
            //意向客户
            companyId: getUrlParamObj().companyId,
            dateTime: '2019',
            key: '',
            regionAuditFlag: '0',
            currentMonth: new Date().Format("M"),
            yxList: [],
            info: [],
            returnFlag: false,
            //全部客户
            cusList: [],
            cusKey: '',
        },
        methods: {
            changeBuyDate:function(buyDate){
                var a='';
                switch (buyDate) {
                    case 'todayMonth':
                        a='本月内'
                        break
                    case 'nextMonth':
                        a='下月内'
                        break
                    case 'threeMonth':
                        a='三月内'
                        break
                    case 'halfYear':
                        a='半年内'
                        break
                }
                return a;
            },
            //获取tab
            get_tab: function () {
                var that = this;
                that.tabList = [
                    {position: 1, name: '意向客户'},
                    {position: 2, name: '应收客户'},
                    {position: 3, name: '全部客户'},
                ]
            },
            //打开基本信息
            clickTab: function (pos) {
                var that = this;
                var obj = {
                    type: 'click',
                    position: pos
                }
                prompt(JSON.stringify(obj));
                that.position = pos;
                if (that.position == 1) {
                    //获取意向客户
                    that.get_customerList_regionManager();
                    that.getTarget();
                }
                if (that.position == 2) {
                    //获取应收客户列表
                    that.getList();
                }
                if (that.position == 3) {
                    //获取全部客户
                    that.get_customer();
                }
            },
            goBack: function () {
                var obj = {
                    activity: 'closePage'
                }
                prompt(JSON.stringify(obj))
            },
            //应收客户
            tablesMergeCell: function (ysList) {
                if (ysList != undefined && ysList && ysList.length > 0) {
                    for (field in ysList[0]) {
                        var k = 0;
                        while (k < ysList.length) {
                            ysList[k][field + 'span'] = 1;
                            ysList[k][field + 'dis'] = false;
                            for (var i = k + 1; i <= ysList.length - 1; i++) {
                                if (ysList[k][field] == ysList[i][field] && ysList[k][field] != '') {
                                    ysList[k][field + 'span']++;
                                    ysList[k][field + 'dis'] = false;
                                    ysList[i][field + 'span'] = 1;
                                    ysList[i][field + 'dis'] = true;
                                } else {
                                    break;
                                }
                            }
                            k = i;
                        }
                    }
                }
                return ysList;
            },
            getList: function () {
                if (this.haveSettle) {
                    this.searchParams.haveSettle = ""
                } else {
                    this.searchParams.haveSettle = 0
                }
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                $.wyui.page.dataUrl = server.ip + "/receivable/selectContractAccountListApp.json"
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams, that.searchParams);
                $.wyui.page.getByPage();
            },
            getNowDate: function () {
                var now = new Date();
                var year = now.getFullYear();
                var month = (now.getMonth() + 1).toString();
                var day = (now.getDate()).toString();
                var hour = (now.getHours()).toString();
                var minute = (now.getMinutes()).toString();
                var second = (now.getSeconds()).toString();
                if (month.length == 1) {
                    month = "0" + month;
                }
                if (day.length == 1) {
                    day = "0" + day;
                }
                if (hour.length == 1) {
                    hour = "0" + hour;
                }
                if (minute.length == 1) {
                    minute = "0" + minute;
                }
                if (second.length == 1) {
                    second = "0" + second;
                }
                var dateTime = year + "-" + month + "-" + day;
                return dateTime;
            },
            compareFiveDate: function (ydDate) {
                var aDate = new Date(this.getNowDate()); // 通过日期字符串，初始化第一个日期对象
                var bDate = new Date(ydDate); // 同上，初始化第二个日期对象
                var aDay = 24 * 60 * 60 * 1000; // 完整一天有24小时，将小时换算成毫秒时间戳
                var diffDay = (bDate - aDate) / aDay; // 计算间隔天数（注意日期隐式转换）
//                console.log(diffDay); // 2，23日-25日间隔2天
                return diffDay;
            },
            fmoney: function (s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            goDetail: function (type, item) {
                var obj = {
                    type: 'goDetail',
                    url: '/apply/accountReceivable/detailApp.html?id=' + item.id + "&pageType=look&userId=" + getUrlParamObj().userId,
                    id: item.id,
                    name: "应收详情",
                    screenType: '0',
                }
                prompt(JSON.stringify(obj))
            },
            //意向客户
            hideFinish: function (str) {
                var that = this;
                if (str <= that.currentMonth) {
                    return true;
                } else {
                    return false;
                }
            },
            openTel: function (item) {
                var that = this;
                var obj = {
                    type: 'tel',
                    name: item.customerName,
                    tel: item.customerTel
                }
                prompt(JSON.stringify(obj));
            },
            // 电话号码中间用*代替
            telNumber: function (telNum) {
                var firstTelNum = telNum.substring(0, 3);
                var lastTelNum = telNum.substring(telNum.length - 4, telNum.length);
                return firstTelNum + "****" + lastTelNum;
            },
            getTarget: function () {
                var that = this;
                //查询大区给区域经理的配置是否审核通过
                $.wyui.postMethod(urlConfig.saleTarget.getBigRegionAuditFlag, {
                    "dateTime": that.dateTime,
                    "userId": that.userId,
                    "companyId": that.companyId,
                }, function (data) {
                    that.regionAuditFlag = data.result.auditFlag;
                    var mainId = data.result.mainId;
                    if (that.regionAuditFlag == '1') {
                        $.wyui.postMethod(urlConfig.saleTarget.getByUserId, {
                            "dateTime": that.dateTime,
                            "userId": that.userId,
                            "mainId": mainId,
                            "companyId": getCurrentUser().companyId,
                        }, function (data) {
                            console.log(data);
                            //是0的处理为空
                            var obj = {};
                            for (var j = 0; j < data.info.length; j++) {
                                if (data.info[j].regionManagerId == that.userId) {
                                    obj = data.info[j];
                                }
                            }

                            for (var key in obj) {
                                if (obj[key] == '0') {
                                    obj[key] = ''
                                }
                            }
                            that.info = obj;
                        });
                    }

                })
            },
            get_customerList_regionManager: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                $.wyui.postMethod(urlConfig.intentionCustomerManagement.getCustomerListByCreateUserId, {
                    "userId": that.userId,
                    "buyDate": '',
                    "key": ''
                }, function (data) {
                    console.log(data.records)

                    var newList = [];
                    for (var i = 0; i < data.records.length; i++) {
                        var item = data.records[i];
                        if (item.buyDate == '七天内' || item.buyDate == "一月内") {
                            if (item.chance != '' && item.chance != '<50%' && item.chance != '0%' && item.chance != '20%') {
                                newList.push(item)
                            }
                        } else {
                            newList.push(item)
                        }
                    }
                    that.yxList = newList;
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                    that.returnFlag = true;
                });
            },
            //打开客户详情
            openDetail: function (customerId, isAdd, pageType) {
                var that = this;
                var obj = {
                    type: 'goDetail',
                    url: '/intentionManagement/quYuIntentionalDetailApp.html?customerId=' + customerId + '&isAdd=' + isAdd + '&pageType=' + pageType + '&userId=' + that.userId + '&companyId=' + that.companyId + '&isRegion=1',
                    name: '意向客户详情',
                    enableRefresh: false
                }
                prompt(JSON.stringify(obj))
            },
            fill3Empty: function (yxList) {
                if (yxList && yxList.length > 0 && yxList.length < 3) {
                    for (var i = 0; i <= 3 - yxList.length; i++) {
                        yxList.push({})
                    }
                }
            },
            //全部客户
            //获取客户管理
            get_customer: function () {
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
                var that = this;
//                var obj1 = {
//                    userId:that.userId,
//                    key:that.cusKey,
//                    pageSize: 30,
//                    requestPage: 1
//                };
////                prompt(JSON.stringify(dialog))
//                $.wyui.page.dataUrl = server.ip + urlConfig.report.customerReport.getAllCustomerList;
//                $.wyui.page.queryParams.requestPage = 1;
//                $.extend($.wyui.page.queryParams,obj1);
//                $.wyui.page.getByPage();

                $.wyui.postMethod(urlConfig.allCustomerReport.getCustomerListByRegionIds, {
                    userIds: that.userId,
                    key: that.cusKey,
                }, function (data) {
                    console.log(data.records)
                    that.cusList = data.records;
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                });

            },
            //查询
            getCusList: function () {
                var that = this;
                var obj = {
                    dialog: 'show'
                }
                prompt(JSON.stringify(obj))
//                $.wyui.page.dataUrl = server.ip + urlConfig.report.customerReport.getAllCustomerList;
//                $.wyui.page.queryParams.key=$.trim(that.cusKey)
//                $.wyui.page.getByPage();

                $.wyui.postMethod(urlConfig.allCustomerReport.getCustomerListByRegionIds, {
                    userIds: that.userId,
                    key: that.cusKey,
                }, function (data) {
                    console.log(data.records)
                    that.cusList = data.records;
                    var obj = {
                        dialog: 'hidden'
                    }
                    prompt(JSON.stringify(obj))
                });
            },
            //客户管理跳转到详情页
            openCustomerDetail: function (item) {
                var id = item.id ? item.id : item.customerId
                var obj = {
                    type: 'lookDetail',
                    url: '/reportForm/newReportForm/customerDetailApp.html?customerId=' + id,
                    name: '客户详情'
                }
                prompt(JSON.stringify(obj))
            },
        },
        mounted: function () {
            var that = this;
            //获取标签列表
            that.get_tab();
            //获取意向客户
            that.get_customerList_regionManager();
            that.getTarget();
        }
    });

    $(function () {
        $("#regionManagerName").autoComplete({
            url: server.ip + urlConfig.system.user.getTop10ByNameUser,
            render: function (users, panel) {
                for (var i = 0; i < users.length; i++) {
                    $("<li></li>").data("autoComplete",
                        users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                        "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                app.searchParams.regionManagerKeyId = user.id;
                app.searchParams.createUserName = user.name;
                return false;
            },
            height: 210,
            width: 220
        });

    });
    $.wyui.page.getByPage_callback = function (records) {
        console.log(records)
        var obj = {
            dialog: 'hidden'
        }
        prompt(JSON.stringify(obj))
        if (app.position == 3) {
            app.cusList = records;
        }
        if (app.position == 2) {
            app.ysList = records;
        }
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        console.log(list)
        var obj = {
            dialog: 'hidden'
        }
        prompt(JSON.stringify(obj))
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                if (this.position == 3) {
                    app.cusList.push(list[i]);
                } else if (this.position == 2) {
                    app.ysList.push(list[i]);
                }
            }
            isLoad = true;
        }
    }
</script>
<script>
    //初始化FixedTable
</script>
<script>
    /************************滚动加载******************************/
    var isLoad = true;
    $(window).scroll(function () {
        // scroll at bottom
//            console.log($(window).scrollTop() + $(window).height(), $(document).height())
        if (app.position != 3) {
            if ($(window).scrollTop() + $(window).height() + 20 > $(document).height()) {
                if (isLoad) {
                    isLoad = false;
                    setTimeout($.wyui.page.getByPage("scroll"), 1000);

                }
                // load data
            }
        }

    });
    //divscroll.onscroll = divScroll;
</script>
</body>
</html>